﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WebCore.Models.DataEntities;
using WebCore.Models.DataManagers;

namespace WebCore.Models.ViewModels.Admin
{
    public class UserDetailViewModel
    {

        public UserDetailViewModel(Guid detailID)
        {
            // TODO: Complete member initialization
            UserDetailID = detailID;
            UserDetail = AccountManager.GetUserDetail(detailID);
            UserName = UserDetail.UserName;
            UserState = UserDetail.State;
            IsSuccess = true;
            Message = String.Empty;
            //
            Roles = string.Empty;
            User u = AccountManager.GetUser(UserDetail.UserID.Value);
            foreach (Role r in u.Roles)
            {
                Roles = Roles + r.RoleId.ToString() + ",";
            }
        }

        public UserDetailViewModel()
        {
            UserDetailID = Guid.Empty;
            IsSuccess = true;
            Message = String.Empty;
            UserName = String.Empty;
        }
        public UserDetail UserDetail { get; set; }
        public Guid UserDetailID { get; set; }
        public bool IsSuccess { get; set; }
        public string Message { get; set; }
        public string UserName { get; set; }
        public string Roles { get; set; }
        public string BackUrl { get; set; }

        public string NewPassword { get; set; }
        public string ConfirmPassword { get; set; }
        public string UserState { get; set; }
    }
}